﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;
using LUStationery.Model;
using LUStationery.DAO;

namespace LUStationery.Controller
{
    public class CollectionPointListControl
    {
        public CollectionPointList getCollectionPoints()
        {
            CollectionPointDAO cDAO = new CollectionPointDAO();
            IDataReader idr = cDAO.getCollectionPoint();
            return CollectionPointListControl.convertIdrToCollectionPointList(idr);
        }

        protected static CollectionPointList convertIdrToCollectionPointList(IDataReader idr)
        {
            CollectionPointList cList = new CollectionPointList();
            while (idr.Read())
            {
                CollectionPoint c = new CollectionPoint();
                c.CollectionPointDesc = Convert.ToString(idr["collection_point"]);
                cList.Add(c);
            }
            return cList;
        }

        protected static CollectionPoint convertIdrToCollectionPoint(IDataReader idr)
        {
            CollectionPoint c = new CollectionPoint();
            while (idr.Read())
            {
                c.CollectionPointDesc = Convert.ToString(idr["collection_point"]);
            }
            return c;
        }
    }
}
